const fse = require('fs-extra')
const fs = require('fs')
const path = require('path')
const matter = require('gray-matter');

const pathResolve = (dir) => {
  return path.resolve(__dirname, '.', dir);
};


const start = async () => {
  try {
    
  } catch (error) {
    
  }
  const baseTemplatePath = pathResolve('./template/base.md');
  const baseOutPath = pathResolve('./out/base.json');
  const fileContent = fs.readFileSync(baseTemplatePath, 'utf-8')
  const fileContentJson = matter(fileContent)
  fse.outputJsonSync(baseOutPath, fileContentJson, { spaces: 2, encoding: 'utf8' })
  console.log('转换完成')
}

start();